package com.budwk.app.sys.commons.task.job;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.budwk.app.fetchdata.models.FetchData_emergency;
import com.budwk.app.fetchdata.services.FetchdataEmergencyService;
import com.budwk.app.miniapp.utils.AddressUtils;
import com.budwk.app.miniapp.utils.HttpUtils;
import com.budwk.starter.email.EmailSendServer;

import com.budwk.starter.job.annotation.SJob;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Cnd;
import org.nutz.ioc.impl.PropertiesProxy;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;


import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ThreadPoolExecutor;


@Slf4j
@IocBean(name = "pullnalWarningIformationService",singleton = false)
public class PullnalWarningIformationService {

    @Inject
    private FetchdataEmergencyService wxSpiderEmergencyInformationService;

    @Inject
    private EmailSendServer emailSendServer;

    @Inject("taskQueryExecutor")
    private ThreadPoolExecutor taskQueryExecutor;
    @Inject
    private PropertiesProxy propertiesProxy;


    private final static Map<String, String> typeMap = new HashMap<>();

    static {
        typeMap.put("11B01_BLUE","台风（蓝色预警）");
        typeMap.put("11B03_BLUE","暴雨（蓝色预警）");
        typeMap.put("11B04_BLUE","暴雪（蓝色预警）");
        typeMap.put("11B05_BLUE","寒潮（蓝色预警）");
        typeMap.put("11B06_BLUE","大风（蓝色预警）");
        typeMap.put("11B07_BLUE","沙尘暴（蓝色预警）");
        typeMap.put("11B09_BLUE","高温（蓝色预警）");
        typeMap.put("11B11_BLUE","干热风（蓝色预警）");
        typeMap.put("11B14_BLUE","雷电（蓝色预警）");
        typeMap.put("11B15_BLUE","冰雹（蓝色预警）");
        typeMap.put("11B16_BLUE","霜冻（蓝色预警）");
        typeMap.put("11B17_BLUE","大雾（蓝色预警）");
        typeMap.put("11B19_BLUE","霾（蓝色预警）");
        typeMap.put("11B20_BLUE","雷雨大风（蓝色预警）");
        typeMap.put("11B21_BLUE","道路结冰（蓝色预警）");
        typeMap.put("11B22_BLUE","干旱（蓝色预警）");
        typeMap.put("11B25_BLUE","火险（蓝色预警）");

        typeMap.put("11B85_BLUE","雷雨强风（蓝色预警）");
        typeMap.put("11B58_BLUE","雷暴大风（蓝色预警）");
        typeMap.put("11B52_BLUE","雷雨大风（蓝色预警）");
        typeMap.put("11B51_BLUE","沙尘（蓝色预警）");
        typeMap.put("11B37_BLUE","地质灾害（蓝色预警）");
        typeMap.put("11B86_BLUE","低温凝冻（蓝色预警）");
        typeMap.put("11D08_BLUE","地质灾害气象风险（蓝色预警）");
        typeMap.put("11A51_BLUE","发布山洪灾害（蓝色预警）");

        typeMap.put("11B41_BLUE","森林草原火险（蓝色预警）");

        typeMap.put("11B01_YELLOW","台风（黄色预警）");
        typeMap.put("11B03_YELLOW","暴雨（黄色预警）");
        typeMap.put("11B04_YELLOW","暴雪（黄色预警）");
        typeMap.put("11B05_YELLOW","寒潮（黄色预警）");
        typeMap.put("11B06_YELLOW","大风（黄色预警）");
        typeMap.put("11B07_YELLOW","沙尘暴（黄色预警）");
        typeMap.put("11B09_YELLOW","高温（黄色预警）");
        typeMap.put("11B11_YELLOW","干热风（黄色预警）");
        typeMap.put("11B14_YELLOW","雷电（黄色预警）");
        typeMap.put("11B15_YELLOW","冰雹（黄色预警）");
        typeMap.put("11B16_YELLOW","霜冻（黄色预警）");
        typeMap.put("11B17_YELLOW","大雾（黄色预警）");
        typeMap.put("11B19_YELLOW","霾（黄色预警）");
        typeMap.put("11B20_YELLOW","雷雨大风（黄色预警）");
        typeMap.put("11B21_YELLOW","道路结冰（黄色预警）");
        typeMap.put("11B22_YELLOW","干旱（黄色预警）");
        typeMap.put("11B25_YELLOW","火险（黄色预警）");

        typeMap.put("11B85_YELLOW","雷雨强风（黄色预警）");
        typeMap.put("11B58_YELLOW","雷暴大风（黄色预警）");
        typeMap.put("11B52_YELLOW","雷雨大风（黄色预警）");
        typeMap.put("11B51_YELLOW","沙尘（黄色预警）");
        typeMap.put("11B37_YELLOW","地质灾害（黄色预警）");
        typeMap.put("11B86_YELLOW","低温凝冻（黄色预警）");
        typeMap.put("11D08_YELLOW","地质灾害气象风险（黄色预警）");
        typeMap.put("11A51_YELLOW","发布山洪灾害（黄色预警）");

        typeMap.put("11B41_YELLOW","森林草原火险（黄色预警）");

        typeMap.put("11B01_ORANGE","台风（橙色预警）");
        typeMap.put("11B03_ORANGE","暴雨（橙色预警）");
        typeMap.put("11B04_ORANGE","暴雪（橙色预警）");
        typeMap.put("11B05_ORANGE","寒潮（橙色预警）");
        typeMap.put("11B06_ORANGE","大风（橙色预警）");
        typeMap.put("11B07_ORANGE","沙尘暴（橙色预警）");
        typeMap.put("11B09_ORANGE","高温（橙色预警）");
        typeMap.put("11B11_ORANGE","干热风（橙色预警）");
        typeMap.put("11B14_ORANGE","雷电（橙色预警）");
        typeMap.put("11B15_ORANGE","冰雹（橙色预警）");
        typeMap.put("11B16_ORANGE","霜冻（橙色预警）");
        typeMap.put("11B17_ORANGE","大雾（橙色预警）");
        typeMap.put("11B19_ORANGE","霾（橙色预警）");
        typeMap.put("11B20_ORANGE","雷雨大风（橙色预警）");
        typeMap.put("11B21_ORANGE","道路结冰（橙色预警）");
        typeMap.put("11B22_ORANGE","干旱（橙色预警）");
        typeMap.put("11B25_ORANGE","火险（橙色预警）");

        typeMap.put("11B85_ORANGE","雷雨强风（橙色预警）");
        typeMap.put("11B58_ORANGE","雷暴大风（橙色预警）");
        typeMap.put("11B52_ORANGE","雷雨大风（橙色预警）");
        typeMap.put("11B51_ORANGE","沙尘（橙色预警）");
        typeMap.put("11B37_ORANGE","地质灾害（橙色预警）");
        typeMap.put("11B86_ORANGE","低温凝冻（橙色预警）");
        typeMap.put("11D08_ORANGE","地质灾害气象风险（橙色预警）");
        typeMap.put("11A51_ORANGE","发布山洪灾害（橙色预警）");

        typeMap.put("11B41_ORANGE","森林草原火险（橙色预警）");

        typeMap.put("11B01_RED","台风（红色预警）");
        typeMap.put("11B03_RED","暴雨（红色预警）");
        typeMap.put("11B04_RED","暴雪（红色预警）");
        typeMap.put("11B05_RED","寒潮（红色预警）");
        typeMap.put("11B06_RED","大风（红色预警）");
        typeMap.put("11B07_RED","沙尘暴（红色预警）");
        typeMap.put("11B09_RED","高温（红色预警）");
        typeMap.put("11B11_RED","干热风（红色预警）");
        typeMap.put("11B14_RED","雷电（红色预警）");
        typeMap.put("11B15_RED","冰雹（红色预警）");
        typeMap.put("11B16_RED","霜冻（红色预警）");
        typeMap.put("11B17_RED","大雾（红色预警）");
        typeMap.put("11B19_RED","霾（红色预警）");
        typeMap.put("11B20_RED","雷雨大风（红色预警）");
        typeMap.put("11B21_RED","道路结冰（红色预警）");
        typeMap.put("11B22_RED","干旱（红色预警）");
        typeMap.put("11B25_RED","火险（红色预警）");
        typeMap.put("11B86_REDE","低温凝冻（红色预警）");

        typeMap.put("11B85_RED","雷雨强风（红色预警）");
        typeMap.put("11B58_RED","雷暴大风（红色预警）");
        typeMap.put("11B52_RED","雷雨大风（红色预警）");
        typeMap.put("11B51_RED","沙尘（红色预警）");
        typeMap.put("11B37_RED","地质灾害（红色预警）");
        typeMap.put("11D08_RED","地质灾害气象风险（红色预警）");
        typeMap.put("11A51_RED","发布山洪灾害（红色预警）");

        typeMap.put("11B41_RED","森林草原火险（红色预警）");

        typeMap.put("10000","突发事件");
        typeMap.put("11000","自然灾害");
        typeMap.put("11A00","水旱灾害");
        typeMap.put("11A01","洪水");
        typeMap.put("11A02","内涝");
        typeMap.put("11A03","水库重大险情(包括垮坝事件)");
        typeMap.put("11A04","堤防重大险情(包括堤防决口事件)");
        typeMap.put("11A05","凌汛灾害");
        typeMap.put("11A51","山洪灾害事件");
        typeMap.put("11A52","农业干旱");
        typeMap.put("11A53","城镇缺水");
        typeMap.put("11A54","生态干旱");
        typeMap.put("11A10","农村人畜饮水困难");
        typeMap.put("11A99","其它水旱灾害");
        typeMap.put("11B00","气象灾害");
        typeMap.put("11B01","台风事件");
        typeMap.put("11B02","龙卷风事件");
        typeMap.put("11B03","暴雨事件");
        typeMap.put("11B04","暴雪事件(包括大雪事件)");
        typeMap.put("11B05","寒潮事件");
        typeMap.put("11B06","大风事件");
        typeMap.put("11B07","沙尘暴事件");
        typeMap.put("11B08","低温冻害事件");
        typeMap.put("11B09","巾高温事件");
        typeMap.put("11B10","热浪事件");
        typeMap.put("11B11","干热风");
        typeMap.put("11B12","下击暴流事件");
        typeMap.put("11B13","雪崩事件");
        typeMap.put("11B14","雷电事件");
        typeMap.put("11B15","冰雹事件(包括风雹)");
        typeMap.put("11B16","霜冻事件");
        typeMap.put("11B17","大雾事件");
        typeMap.put("11B18","低空风切变事件(可能引发航空器飞行事故)");
        typeMap.put("11B19","霾");
        typeMap.put("11B20","雷雨大风");
        typeMap.put("11B21","道路结冰");
        typeMap.put("11B22","干旱");
        typeMap.put("11B23","海上大风");
        typeMap.put("11B24","高温中暑");
        typeMap.put("11B25","森林火险");
        typeMap.put("11B26","草原火险");
        typeMap.put("11B27","冰冻");
        typeMap.put("11B28","空间天气");
        typeMap.put("11B29","重污染");
        typeMap.put("11B30","低温雨雪冰冻");
        typeMap.put("11B31","强对流");
        typeMap.put("11B32","臭氧");
        typeMap.put("11B33","大雪");
        typeMap.put("11B34","寒冷");
        typeMap.put("11B35","连阴雨");
        typeMap.put("11B36","渍涝风险");
        typeMap.put("11B37","地质灾害");
        typeMap.put("11B99","其它气象灾害");
        //后面添加
        typeMap.put("11B85","雷雨强风");
        typeMap.put("11B58","雷暴大风");
        typeMap.put("11B52","雷雨大风");
        typeMap.put("11B51","沙尘");
        typeMap.put("11B86","低温凝冻");
        typeMap.put("11D08","地质灾害气象风险");





        typeMap.put("Blue","蓝色预警");
        typeMap.put("Orange","橙色预警");
        typeMap.put("Yellow","黄色预警");
    }






    /**
     * 中国气象预警信息
     * @return
     */
     @SJob("emergencyInformation")
    public void emergencyInformation(String taskId, String params) {

        Date day2 = new Date();
        SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        day2.setHours(day2.getHours() - 72);
        try {
            System.out.println("国家预警信息发布中心预警信息: "+new Date());
            List<FetchData_emergency> emergencyInfoList = new ArrayList<>();

            String result = HttpUtils.getRequest("https://weather.cma.cn/api/map/alarm?adcode=");
            JSONObject dataJson = JSONObject.parseObject(result);
            //String  picUrl ="https://dfsj-standard.obs.cn-south-1.myhuaweicloud.com/dfxy_disaster/";
            JSONArray listJson = dataJson.getJSONArray("data");
            for (int i = 0; i < listJson.size(); i++) {

                FetchData_emergency infoBo = new FetchData_emergency();
                JSONObject item = listJson.getJSONObject(i);
                infoBo.setInformationtitle(item.getString("headline"));
                String startDate = item.getString("effective").replaceAll("/", "-") + ":00";
                infoBo.setReleasetime(Timestamp.valueOf(startDate));

                Timestamp send_time =Timestamp.valueOf(startDate); //三天之前的数据不入库
                Timestamp start =Timestamp.valueOf(sdf2.format(day2));
                if(send_time.compareTo(start)<0) continue;

                JSONObject addressInfo =null;
                JSONObject jsonresult=null;
                FetchData_emergency vo = wxSpiderEmergencyInformationService.fetch(Cnd.where(FetchData_emergency::getInformationtitle,"=",infoBo.getInformationtitle())
                        .and(FetchData_emergency::getReleasetime,"=",infoBo.getReleasetime()));
                infoBo.setLongitude(item.getString("longitude"));
                infoBo.setLatitude(item.getString("latitude"));
                if (ObjectUtil.isEmpty(vo)) {
                    addressInfo = AddressUtils.getAddressInfo(item.getString("longitude"), item.getString("latitude"));
                    if(addressInfo!=null) {
                        jsonresult = addressInfo.getJSONObject("result");
                        if (jsonresult != null) {
                            String formatted_address = jsonresult.getString("formatted_address");
                            JSONObject addressComponent = jsonresult.getJSONObject("addressComponent");
                            String province = addressComponent.getString("province");
                            String city = addressComponent.getString("city");
                            String county = addressComponent.getString("county");
                            // String district = addressComponent.getString("road");
                            // String poi = addressComponent.getString("poi");
                            if(province!=null&&city!=null&&county!=null) {
                                infoBo.setDisaster_address(province + city + county);
                            }
                            if (province == "" || province == null || province.equals("全球")) {
                                infoBo.setDisaster_address("【国外】");
                            }

                            infoBo.setProvince(province);
                            infoBo.setCity(city);
                            infoBo.setDistrict(county);
//                                infoBo.setStreet(district);
//                                if (poi != null && poi.contains("村")) {
//                                    infoBo.setStreet(poi);
//                                }


                        } else {
                            // infoBo.setDisasterAddress(item.getString("headline"));
                            infoBo.setProvince("");
                            if (item.getString("headline").indexOf("省") > 0) {
                                infoBo.setProvince(item.getString("headline").substring(0, item.getString("headline").indexOf("省")+1));
                            }
                            infoBo.setCity("");
                            if (item.getString("headline").indexOf("市") > 0) {
                                infoBo.setCity(item.getString("headline").substring(0, item.getString("headline").indexOf("市")+1));
                            }
                            infoBo.setDistrict("");
                            if (item.getString("headline").indexOf("县") > 0) {
                                infoBo.setDistrict(item.getString("headline").substring(0, item.getString("headline").indexOf("县")+1));
                            }
                            if (item.getString("headline").indexOf("区") > 0) {
                                infoBo.setDistrict(item.getString("headline").substring(0, item.getString("headline").indexOf("区")+1));
                            }
                            // infoBo.setDisasterAddress(infoBo.get + city + county);
                            // infoBo.setStreet("");
                        }

                    }
                    else {
                        // infoBo.setDisasterAddress(item.getString("headline"));
                        infoBo.setProvince("");
                        if (item.getString("headline").indexOf("省") > 0) {
                            infoBo.setProvince(item.getString("headline").substring(0, item.getString("headline").indexOf("省")+1));
                        }
                        infoBo.setCity("");
                        if (item.getString("headline").indexOf("市") > 0) {
                            infoBo.setCity(item.getString("headline").substring(0, item.getString("headline").indexOf("市")+1));
                        }
                        infoBo.setDistrict("");
                        if (item.getString("headline").indexOf("县") > 0) {
                            infoBo.setDistrict(item.getString("headline").substring(0, item.getString("headline").indexOf("县")+1));
                        }
                        if (item.getString("headline").indexOf("区") > 0) {
                            infoBo.setDistrict(item.getString("headline").substring(0, item.getString("headline").indexOf("区")+1));
                        }
                        // infoBo.setDisasterAddress(infoBo.get + city + county);
                        // infoBo.setStreet("");
                    }

                    if((infoBo.getProvince()==null||infoBo.getProvince().equals(""))&&(infoBo.getCity()==null||infoBo.getCity().equals(""))&&(infoBo.getDistrict()==null||infoBo.getDistrict().equals("")))
                    {
                            if(item.getString("headline").indexOf("气象台")>0) {
                                 infoBo.setDistrict(item.getString("headline").substring(0, item.getString("headline").indexOf("气象台")));
                            }
                            if (infoBo.getDistrict() == null || infoBo.getDistrict().equals("")) {
                                if(item.getString("headline").indexOf("气象局")>0) {
                                  infoBo.setDistrict(item.getString("headline").substring(0, item.getString("headline").indexOf("气象局")));
                                }
                            }
                            if (infoBo.getDistrict() == null || infoBo.getDistrict().equals("")) {
                                  infoBo.setDistrict(item.getString("headline").substring(0, 2));
                            }
                    }

                    if(infoBo.getProvince()==null||infoBo.getProvince().length()<2||infoBo.getProvince()=="") {
                        ConcurrentHashMap map = new ConcurrentHashMap();
                        if (infoBo.getCity() != null&&infoBo.getCity().length()>2)
                        {
                            map = AddressUtils.getLatAndLngByAddr(infoBo.getCity());
                        }
                        if (infoBo.getDistrict() != null&&infoBo.getDistrict().length()>1)
                        {
                            map = AddressUtils.getLatAndLngByAddr(infoBo.getDistrict());
                        }
                        if(map.get("lng")!=null&&map.get("lat")!=null) {
                            infoBo.setLongitude(String.valueOf(map.get("lng")));
                            infoBo.setLatitude(String.valueOf(map.get("lat")));
                            addressInfo = AddressUtils.getAddressInfo(String.valueOf(map.get("lng")), String.valueOf(map.get("lat")));
                            if (addressInfo != null) {
                                jsonresult = addressInfo.getJSONObject("result");
                                if (jsonresult != null) {
                                    JSONObject addressComponent = jsonresult.getJSONObject("addressComponent");
                                    infoBo.setProvince(addressComponent.getString("province"));
                                    String city=addressComponent.getString("city");
                                    city=city.indexOf("省")>0?city.substring(city.indexOf("省")+1):city;
                                    infoBo.setCity(city);
                                    if(infoBo.getDistrict()==null||infoBo.getDistrict().equals(""))
                                    infoBo.setDistrict(addressComponent.getString("county"));
                                    if((infoBo.getProvince()==null||infoBo.getProvince().equals(""))&&jsonresult.getString("formatted_address")!=null &&jsonresult.getString("formatted_address").indexOf("省")>0) {
                                        infoBo.setProvince(jsonresult.getString("formatted_address").substring(0,jsonresult.getString("formatted_address").indexOf("省")+1));
                                    }
                                    infoBo.setDisaster_address(addressComponent.getString("province") + addressComponent.getString("city") + addressComponent.getString("county"));
                                }
                            }
                        }
                    }

                    if((infoBo.getCity()==null||infoBo.getCity().equals(""))&&infoBo.getDistrict()!=null)
                    {
                        infoBo.setCity(infoBo.getDistrict());
                    }

                    infoBo.setInformationcontent(item.getString("description") + " （预警信息来源：国家预警信息发布中心）");
                    infoBo.setInformationmedia("国家预警信息发布中心");

                    infoBo.setDisaster_status("灾害");
                    infoBo.setInformationchannels(item.getString("headline").indexOf("发布") > 0 ? item.getString("headline").substring(0, item.getString("headline").indexOf("发布")) : item.getString("headline"));
                    if(infoBo.getInformationtitle().equals(infoBo.getInformationchannels())||item.getString("headline").indexOf("气象台") > 0) {
                        infoBo.setInformationchannels(item.getString("headline").indexOf("气象台") > 0 ? item.getString("headline").substring(0, item.getString("headline").indexOf("气象台")+3) : item.getString("headline"));
                    }
                    if(infoBo.getInformationtitle().equals(infoBo.getInformationchannels())||item.getString("headline").indexOf("气象局") > 0) {
                        infoBo.setInformationchannels(item.getString("headline").indexOf("气象局") > 0 ? item.getString("headline").substring(0, item.getString("headline").indexOf("气象局")+3) : item.getString("headline"));
                    }

                    infoBo.setPicurl(item.getString("type")+".png");

                    String type=typeMap.get(item.getString("type"));
                    if (type!=null&&type.indexOf("（") > 0 && type.lastIndexOf("）") > 0) {
                        infoBo.setDisaster_class(type.substring(type.indexOf("（")+1,type.indexOf("）")));
                        infoBo.setDisaster_type(type.substring(0,type.indexOf("（")));
                    }
                    if(infoBo.getPicurl()!=null&&(infoBo.getPicurl().contains("UNKNOWN")||infoBo.getPicurl().contains("11D08")||infoBo.getPicurl().contains("11D08")||infoBo.getPicurl().contains("11A51")||infoBo.getPicurl().contains("11B41")))//
                    {
                        infoBo.setPicurl("other.png");
                    }
                    if(infoBo.getDisaster_type()!=null&&infoBo.getDisaster_type().equals("其他")) //
                    {
                        infoBo.setPicurl("other.png");
                    }

                    //去掉异常类型
                    if(infoBo.getDisaster_type()!=null&&infoBo.getDisaster_type().indexOf("(")>0)
                    {
                        infoBo.setDisaster_type(infoBo.getDisaster_type().substring(0,infoBo.getDisaster_type().indexOf("(")));
                    }
                    if(infoBo.getDisaster_type()!=null&&infoBo.getDisaster_type().indexOf("巾")>0)
                    {
                        infoBo.setDisaster_type(infoBo.getDisaster_type().replace("巾",""));
                    }

                    if(infoBo.getDisaster_type() ==null) {
                        int startIndex = infoBo.getInformationtitle().indexOf("发布")+2;
                        int endIndex = infoBo.getInformationtitle().indexOf("预警") - 2;
                        // 进行截取
                        if (startIndex != -1 && endIndex != -1 && endIndex > startIndex) {
                            infoBo.setDisaster_type( infoBo.getInformationtitle().substring(startIndex, endIndex));
                            infoBo.setPicurl("other.png");
                        } else {
                            System.out.println("无法找到合适的开始和结束位置");
                        }
                    }
                    if(infoBo.getDisaster_class() ==null) {
                        int startIndex = infoBo.getInformationtitle().indexOf("预警")-2;
                        int endIndex = infoBo.getInformationtitle().indexOf("预警") +2;
                        // 进行截取
                        if (startIndex != -1 && endIndex != -1 && endIndex > startIndex) {
                            infoBo.setDisaster_class( infoBo.getInformationtitle().substring(startIndex, endIndex));
                        } else {
                            System.out.println("无法找到合适的开始和结束位置");
                        }
                    }
                    //不等于高温红色，干旱红色
                    if(infoBo.getDisaster_class()!=null&&infoBo.getDisaster_class().equals("红色预警")&&!item.getString("type").equals("11B09_RED")&&!item.getString("type").equals("11B22_RED")) ////发邮件
                    {
                        List<String> sendUser=new ArrayList<>();
                        // 发送内容
                        String emileSend= propertiesProxy.get("email.Send");
                        if(StrUtil.isNotBlank(emileSend)){
                            sendUser=Arrays.asList(emileSend.split(","));
                        }
                        CompletableFuture[] cf = sendUser.stream().map(emile -> CompletableFuture.runAsync(() ->
                                        emailSendServer.sendMsg("用户" ,infoBo.getInformationtitle(), emile, infoBo.getInformationcontent()), taskQueryExecutor)
                                .thenApply(r -> r)).toArray(CompletableFuture[]::new);
                    }
                    infoBo.setAddperson("祥云AI");
                    infoBo.setAddphone("18888888888");
                    //添加人等
                    Date day = new Date();
                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                    infoBo.setAddtime(sdf.format(day));
                    infoBo.setIsshow("0");
                    emergencyInfoList.add(infoBo);

                }
            }
            if(CollectionUtil.isNotEmpty(emergencyInfoList)){
                wxSpiderEmergencyInformationService.fastInsert(emergencyInfoList);
            }
        } catch(Exception e) {
            e.printStackTrace();
        }
    }



}
